import { cafReq } from "..";

export const baseURL = `${import.meta.env.VITE_FIN_URL}/finance-user`;

// 查询部门
export const getDepart = async (departmentID: any) => {
  return await cafReq(0, { baseURL }).post(
    `/department/getBlowDepartment/${departmentID}`
  );
};

// 查询部门列表
export const listDept = async (query?: any) => {
  return await cafReq(0, { baseURL }).post(`/material/org/v1/search`, query);
};

// 查询部门列表（排除节点）
export const listDeptExcludeChild = async (query?: any) => {
  return await cafReq(0, { baseURL }).post(`/material/org/v1/search`, query);
  // return request({
  //   url: '/system/dept/list/exclude/' + deptId,
  //   method: 'get'
  // })
};

// 查询部门详细
export const getDept = async (deptId: string | number) => {
  return await cafReq(0, { baseURL }).get(`/material/org/v1/get/${deptId}`);
};

// 新增部门
export const addDept = async (data: any) => {
  return await cafReq(0, { baseURL }).post(`/material/org/v1/add`, data);
};

// 修改部门
export const updateDept = async (data: any) => {
  return await cafReq(0, { baseURL }).post(`/material/org/v1/update`, data);
};

// 删除部门
export const delDept = async (deptId: string | number) => {
  return await cafReq(0, { baseURL }).delete(
    `/material/org/v1/delete/${deptId}`
  );
};
